package backend

import "github.com/gogf/gf/v2/frame/g"

type UserLogoutReq struct {
	g.Meta `path:"/user/logout" method:"get" summary:"执行用户注销接口" tags:"用户"`
}

type UserLogoutRes struct {
	g.Meta `mime:"text/html" type:"string" example:"<html/>"`
}

type UserIndexReq struct {
	g.Meta `path:"/user/index" method:"get" summary:"用户列表页面" tags:"用户"`
}

type UserIndexRes struct {
	g.Meta `mime:"text/html" type:"string" example:"<html/>"`
}

type UserIndexListReq struct {
	g.Meta   `path:"/user/list" method:"get" summary:"用户列表数据" tags:"用户"`
	Username string `json:"username"`
	Status   int    `json:"status"`
	CommonPaginationReq
}

type UserIndexListRes struct {
	Data interface{} `json:"data"`
	CommonPaginationRes
}

type UserShowCreateReq struct {
	g.Meta `path:"/user/create" method:"get" summary:"用户创建页面" tags:"用户"`
}

type UserShowCreateRes struct {
	g.Meta `mime:"text/html" type:"string" example:"<html/>"`
}

type UserCreateReq struct {
	g.Meta   `path:"/user/create" method:"post" tags:"用户" summary:"创建用户接口"`
	Username string `json:"username"    v:"required#用户名不可为空" dc:"用户名"`
	RealName string `json:"realName"    v:"required#真实姓名不可为空"      dc:"真实姓名"`
	Password string `json:"password"   v:"required#请输入密码"      dc:"密码"`
	Phone    string `json:"phone" v:"required#请输入电话"      dc:"电话"`
	Email    string `json:"email"   dc:"邮箱"`
	Status   int    `json:"status"   dc:"状态"`
	Roles    []uint `json:"roles"   dc:"角色Ids"`
}

type UserCreateRes struct {
	UserId uint `json:"userId"`
}

type UserShowUpdateReq struct {
	g.Meta `path:"/user/update/{Id}" method:"get" summary:"用户修改页面" tags:"用户"`
	Id     uint `json:"id"`
}

type UserShowUpdateRes struct {
	g.Meta `mime:"text/html" type:"string" example:"<html/>"`
}

type UserUpdateReq struct {
	g.Meta   `path:"/user/update/{Id}" method:"post" tags:"用户" summary:"修改用户接口"`
	Id       uint   `json:"id"      v:"min:1#请选择需要修改的用户" dc:"用户Id"`
	Username string `json:"username"    v:"required#用户名不可为空" dc:"用户名"`
	RealName string `json:"realName"    v:"required#真实姓名不可为空"      dc:"真实姓名"`
	Password string `json:"password"   dc:"密码"`
	Phone    string `json:"phone" v:"required#请输入电话"      dc:"电话"`
	Email    string `json:"email"   dc:"邮箱"`
	Status   int    `json:"status"   dc:"状态"`
	Roles    []uint `json:"roles"   dc:"角色Ids"`
}

type UserUpdateRes struct{}

type UserShowViewReq struct {
	g.Meta `path:"/user/view/{Id}" method:"get" summary:"用户查看页面" tags:"用户"`
	Id     uint `json:"id"      v:"min:1#请选择需要查看的用户" dc:"用户Id"`
}

type UserShowViewRes struct {
	g.Meta `mime:"text/html" type:"string" example:"<html/>"`
}

type UserShowUpdatePasswordReq struct {
	g.Meta `path:"/user/update-password" method:"get" summary:"用户修改密码页面" tags:"用户"`
}

type UserShowUpdatePasswordRes struct {
	g.Meta `mime:"text/html" type:"string" example:"<html/>"`
}

type UserUpdatePasswordReq struct {
	g.Meta      `path:"/user/update-password" method:"post" summary:"用户修改密码" tags:"用户"`
	OldPassword string `json:"old_password"    v:"required#原密码不可为空" dc:"原密码"`
	NewPassword string `json:"new_password"    v:"required#新密码不可为空" dc:"新密码"`
	RepPassword string `json:"rep_password"    v:"required#重复密码不可为空" dc:"重复密码"`
}

type UserUpdatePasswordRes struct{}

// 显示更新用户信息界面

type UserShowInfoReq struct {
	g.Meta `path:"/user/info" method:"get" summary:"用户中心页面" tags:"用户"`
}

type UserShowInfoRes struct {
	g.Meta `mime:"text/html" type:"string" example:"<html/>"`
}

// 更新用户信息

type UserUpdateInfoReq struct {
	g.Meta         `path:"/user/info" method:"post" summary:"用户修改信息" tags:"用户"`
	AvatarUrl      string `json:"avatar_url"  dc:"头像"`
	IsUpdateAvatar bool   `json:"is_update_avatar"  dc:"是否修改头像"`
	Phone          string `json:"phone"    v:"required|phone#联系电话不可为空|手机号格式错误" dc:"联系电话"`
	Email          string `json:"email"    v:"required|email#邮箱不可为空|邮箱格式错误" dc:"邮箱"`
	RealName       string `json:"real_name"    v:"required#姓名不可为空" dc:"姓名"`
	Remark         string `json:"remark"  dc:"个人简介"`
}

type UserUpdateInfoRes struct{}
